﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1.DesignerPatter.Visitor.test
{
    public abstract class Person
    {
        private string strState = "";

        public string State
        {
            get { return strState; }
            set { this.strState = value; }
        }

        public abstract void Reaction(string state);
    }

    public class Man : Person
    {
        public  override void Reaction(string state)
        {
            if (state.Equals("成功"))
            {
                Console.WriteLine("男人成功时，背后多半有个伟大的女人");
            }
            else if(state .Equals("失败"))
            {
                Console.WriteLine("男人失败时，闷头喝酒，谁也不用劝");
            }
        } 
    }

    public class Women : Person
    {
        public override void Reaction(string state)
        {
            if (state.Equals("成功"))
            {
                Console.WriteLine("女人成功时，背后多半有个不成功的男人");
            }
            else if (state.Equals("失败"))
            {
                Console.WriteLine("女人失败时，眼泪汪汪，谁也劝不了");
            }
        }
    }
}
